package com.bootdo.lgs.lgsInterfaces.acommon.service.impl;

import com.bootdo.lgs.lgsInterfaces.acommon.dao.AcommonMapper;
import com.bootdo.lgs.lgsInterfaces.acommon.model.AcommonCondition;
import com.bootdo.lgs.lgsInterfaces.acommon.service.AcommonService;
import com.bootdo.lgs.order.model.LgsOrder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class AcommonServiceImpl implements AcommonService {

    private static final Logger logger = LoggerFactory.getLogger(AcommonServiceImpl.class);

    @Autowired
    private AcommonMapper acommonMapper;

    @Override
    public List<LgsOrder> getUnCheckOrderTrace(String lgsCompanyCd) {
        AcommonCondition condition = new AcommonCondition();
        condition.setLgs_company_cd(lgsCompanyCd);
        return getUnCheckOrderTrace(condition);
    }

    @Override
    public List<LgsOrder> getUnCheckOrderTrace(AcommonCondition condition) {
        try {
            return acommonMapper.getUnCheckOrderTrace(condition);
        } catch (Exception e) {
            if (condition != null)
                logger.warn("查询【" + condition.getLgs_company_cd() + "】未签收订单失败", e);
            return new ArrayList<>();
        }
    }

}
